home *** CD-ROM | disk | FTP | other *** search
- /*** File: "Cstring_P_v30.cp"
- *
- * String Manager. It manages the sting in
- * PASCAL and C formats.
- *
- * The string always must be in the right C format.
- *
- ****/
- #ifndef __Cstring_P__
- #define __Cstring_P__
-
- typedef struct
- {
- long len;
- char *str;
- } strDescRec;
- typedef strDescRec *strDescPtr, **strDescHdl;
-
- #include "memoryHandle.h"
- class Cstring_P
- {
- private:
- Ptr str; // the string pointer.
- unsigned short maxCh; // max caracter number it can store.
- strDescHdl altStrDesc; // descrittore alternativo delle stringhe
-
- public:
- static unsigned char maxPascalCh; // the maximun char in a Pascal string.
-
- /*** constructor.
- *
- ***/
- Cstring_P(void);
-
- /*** Delete the object.
- *
- ****/
- ~Cstring_P(void);
-
- /*** Set the string Lenght
- *
- * INPUT par: 'maxCh' the number of char.
- * if 0 'maxCh' is eq to the
- * longest PASCAL string.
- * Val OUTPUT: true/false se ha allocato o meno la stringa.
- *
- ***/
- Boolean Istring_P(unsigned short maxCh = 255);
-
- /*** Destroy the string.
- *
- ***/
- void dispose(void);
-
- /*** Read the string Lenght
- *
- * OUTPUL val: the maximus number of char.
- *
- ***/
- unsigned short rMaxCh(void);
-
- /*** Return the string pointer:
- *
- * OUTPUT val: the string pointer.
- *
- ***/
- Ptr rStr(void);
-
- /*** Return the C string pointer:
- *
- * OUTPUT val: the string pointer.
- *
- ****/
- char *C(void);
-
- /*** Reurn the string descriptor
- *
- ****/
- strDescHdl readStr();
-
- /***
- *
- * Copy_from(pos, str);
- *
- ***/
- Boolean writeStr(Handle str);
-
- /***
- *
- * rHandle();
- *
- ***/
- Handle rHandle(void);
-
- /*** Read the string 'str' in PASCAL format:
- *
- * OUTPUT val: the string pointer.
- *
- ***/
- unsigned char *P(Boolean Cstring = true);
-
- /*** Convert the internal string in C format
- *
- * To use only if the sting has been modified in PASCAL format.
- *
- ***/
- void Cvalidate(void);
-
- /*** Copy a string object:
- *
- * Copy the string char until the first NULL char.
- *
- * INPUT par: '*str' the string object.
- * OUTPUT val: true if the string is too long, false otherwise.
- *
- ***/
- Boolean transfer(Cstring_P *str);
-
- /*** Transfer a C string:
- *
- * INPUT par: '*str' the string point in C format.
- * OUTPUT val: true if the C string is too long, false otherwise.
- *
- ***/
- Boolean Ctransfer(char *str);
-
- /*** Transfer a Pascal string:
- *
- * INPUT par: '*str' the string point in C format.
- * OUTPUT val: true if the C string is too long, false otherwise.
- *
- ***/
- Boolean Ptransfer(unsigned char *str);
-
- /*** Add a C string:
- *
- * INPUT par: '*str' the string point in C format.
- * OUTPUT val: true if the C string is too long, false otherwise.
- *
- ***/
- Boolean Add(char *str);
-
- /***
- *
- * Copy_from(pos, str);
- *
- ***/
- Boolean Copy(int begin, int end, char *str);
-
- private:
- /***
- *
- * Copy_from(pos, str);
- *
- ***/
- Boolean Copy_from(int pos, char *str);
- };
- #endif